package com.wd.live

import com.bw.base.net.data.ResponseBean
import com.wd.live.tool.LocalData
import io.reactivex.Observable
import okhttp3.MultipartBody
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.Headers
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.QueryMap

interface ApiServer {


    @GET("live-user/findAnchorInfo")
    fun findAnchorInfo(): Observable<ResponseBean<LocalData.AnchorInfo>>

    /**
     * 查看我的关注
     */
    @GET("live-user/verify/findMyAttention")
    fun findMyAttention(@QueryMap params: HashMap<String, Any>): Observable<ResponseBean<LocalData.AnchorInfo>>


    /**
     * 微信登陆
     */
    @Headers("Content-Type: application/x-www-form-urlencoded")
    @POST("live-user/wxLogin")
    fun wxLogin(@QueryMap params: HashMap<String, Any>): Observable<ResponseBean<LocalData.UserInfo>>

    /**
     * 获取附近直播列表
     */
    @Headers("Content-Type: application/x-www-form-urlencoded")
    @GET("live-platform/findNearbyLive")
    fun getNearList(
        @Header("userId") userId: Int,
        @QueryMap params: HashMap<String, Any?>
    ): Observable<ResponseBean<ArrayList<LocalData.BroadcasterInfo>>>

    @Multipart
    @POST("live-platform/verify/openLive")
    fun openLive(
        @Header("userId") userId: Int,
        @Header("sessionId") sessionId: String,
        @QueryMap params: HashMap<String, Any?>,
        @retrofit2.http.Part image: MultipartBody.Part?
    ): Observable<LocalData.ResponseLiveBean<LocalData.LiveInfo>>

    @PUT("live-platform/verify/startPushStream")
    fun pushLive(
        @Header("userId") userId: Int,
        @Header("sessionId") sessionId: String,
        @QueryMap params: HashMap<String, Any?>
    ): Observable<ResponseBean<Any>>

    @DELETE("live-platform/verify/closeLive")
    fun closeLive(
        @Header("userId") userId: Int,
        @Header("sessionId") sessionId: String
    ): Observable<ResponseBean<Any>>

    @GET("live-platform/watchLive")
    fun lookLive(
        @Header("userId") userId: Int,
        @Header("sessionId") sessionId: String,
        @QueryMap params: HashMap<String, Any?>
    ): Observable<ResponseBean<LocalData.LookLiveInfo>>

    @Headers("Content-Type: application/x-www-form-urlencoded")
    @GET("live-platform/findLiveTypeList")
    fun getFindLiveTypeList(
        @Header("userId") userId: Int,
        @Header("sessionId") sessionId: String,
    ): Observable<ResponseBean<ArrayList<LocalData.TypeInfo>>>

    /**
     * 获取直播列表
     */
    @Headers("Content-Type: application/x-www-form-urlencoded")
    @GET("live-platform/findLiveList")
    fun getLiveList(
        @Header("userId") userId: Int,
        @Header("sessionId") sessionId: String, @QueryMap params: HashMap<String, Any?>
    ): Observable<ResponseBean<ArrayList<LocalData.LiveShow>>>


    /**
     * 请求连麦
     * 观众申请直播连麦互动
     */
    @PUT("live-platform/verify/applyLiveInteract")
    fun requestLink(
        @Header("userId") userId: Int,
        @Header("sessionId") sessionId: String,
        @QueryMap params: HashMap<String, Any?>
    ): Observable<ResponseBean<Any>>

    /**
     * 获取礼物数据
     *
     */
    @GET("live-platform/findAllGift")
    fun getGiftList(
        @Header("userId") userId: Int,
        @Header("sessionId") sessionId: String
    ): Observable<ResponseBean<MutableList<LocalData.GiftInfo>>>


    /**
     * 送礼
     *
     */
    @POST("live-platform/verify/handselGift")
    fun sendGift(
        @Header("userId") userId: Int,
        @Header("sessionId") sessionId: String,
        @QueryMap params: HashMap<String, Any?>
    ): Observable<ResponseBean<MutableList<LocalData.GiftInfo>>>


    /**
     * 充值
     *
     */
    @POST("live-user/verify/recharge")
    fun recharge(
        @Header("userId") userId: Int,
        @Header("sessionId") sessionId: String,
        @QueryMap params: HashMap<String, Any?>
    ): Observable<ResponseBean<String>>
}
